#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
const int N = 1e5 + 10, M = 2 * N;
int h[N], e[M], w[M], ne[M], idx;
int dis[N];
bool st[N];
int n, m;
int spfa(int s)
{
	memset(dis, 0x3f, sizeof(dis));
	dis[s] = 0;
	queue<int>q;
	q.push(s);
	st[s] = 1;
	while (q.size()) {
		int t = q.front();
		st[t] = 0;
		q.pop();
		for (int i = h[t]; ~i; i = ne[i]) {
			int j = e[i];
			if (dis[j] > dis[t] + w[i]) {
				dis[j] = dis[t] + w[i];
				if (!st[j]) {
					st[j] = 1;
					q.push(j);
				}
			}
		}
	}
}
int main()
{
	cin >> n >> m;
	return 0;
}